
<meta charset="utf-8">
<script>

    var txuPrice = 245;
    var txuCount = 2;
    var shoePrice = 570;
    var shoeCount = 10;
    var paiPrice = 320;
    var paiCount = 1;
    var discount = 0.8;
    var totalPrice = txuPrice * txuCount + shoePrice * shoeCount + paiPrice * paiCount;
    var userPrice = 5300;

    document.write("<table border='0' cellspacing='20' align='center'>");

    document.write("<tr>");
    document.write("<td colspan='4' align='center'>*******消费清单*******<td>");
    document.write("</tr>");

    document.write("<tr>");
    document.write("<td>购买商品</td><td>单价</td><td>数量</td><td>金额</td>");
    document.write("</tr>");

    document.write("<tr>");
    document.write("<td>t恤</td><td>&yen;" + txuPrice + "</td><td>" + txuCount + "</td><td>&yen;" + txuPrice * txuCount + "</td>");
    document.write("</tr>");

    document.write("<tr>");
    document.write("<td>网球鞋</td><td>&yen;" + shoePrice + "</td><td>" + shoeCount + "</td><td>&yen;" + shoePrice * shoeCount + "</td>");
    document.write("</tr>");

    document.write("<tr>");
    document.write("<td>网球拍</td><td>&yen;" + paiPrice + "</td><td>" + paiCount + "</td><td>&yen;" + paiPrice * paiCount + "</td>");
    document.write("</tr>");

    document.write("<tr>");
    document.write("<td>折扣：</td><td colspan='3'>" + discount + "</td>");
    document.write("</tr>");

    document.write("<tr>");
    document.write("<td>消费总金额：</td><td colspan='3'>&yen;" + totalPrice * discount + "</td>");
    document.write("</tr>");

    document.write("<tr>");
    document.write("<td>实际消费：</td><td colspan='3'>&yen;" + userPrice + "</td>");
    document.write("</tr>");

    document.write("<tr>");
    document.write("<td>找零：</td><td colspan='3'>&yen;" + (userPrice - totalPrice * discount) + "</td>");
    document.write("</tr>");

    document.write("</table>");
</script>